let timer = null

export function throttle(callback, duration) {
  return function () {
    if (!timer) {
      timer = setTimeout(function () {
        callback()
        timer = null
      }, duration)
    }
  }
}